home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat2 / standard / shmop.z / shmop
Encoding:
Text File  |  2002-10-03  |  10.3 KB  |  199 lines

  1.  
  2.  
  3.  
  4. sssshhhhmmmmoooopppp((((2222))))                                                              sssshhhhmmmmoooopppp((((2222))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _ssss_hhhh_mmmm_oooo_pppp: _ssss_hhhh_mmmm_aaaa_tttt, _ssss_hhhh_mmmm_dddd_tttt - shared memory operations
  10.  
  11. CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
  13.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_iiii_pppp_cccc_...._hhhh_>>>>
  14.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_ssss_hhhh_mmmm_...._hhhh_>>>>
  15.  
  16.      _vvvv_oooo_iiii_dddd _****_ssss_hhhh_mmmm_aaaa_tttt_((((_iiii_nnnn_tttt _ssss_hhhh_mmmm_iiii_dddd_,,,, _vvvv_oooo_iiii_dddd _****_ssss_hhhh_mmmm_aaaa_dddd_dddd_rrrr_,,,, _iiii_nnnn_tttt _ssss_hhhh_mmmm_ffff_llll_gggg_))))_;;;;
  17.  
  18.      _iiii_nnnn_tttt _ssss_hhhh_mmmm_dddd_tttt _((((_vvvv_oooo_iiii_dddd _****_ssss_hhhh_mmmm_aaaa_dddd_dddd_rrrr_))))_;;;;
  19.  
  20. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  21.      _ssss_hhhh_mmmm_aaaa_tttt attaches the shared memory segment associated with the shared
  22.      memory identifier specified by _s_h_m_i_d to the data segment of the calling
  23.      process.  The segment is attached at the address specified by one of the
  24.      following criteria:
  25.  
  26.           If _s_h_m_a_d_d_r is equal to _((((_vvvv_oooo_iiii_dddd _****_)))) _0000, the segment is attached at the
  27.           first available address as selected by the system.  If
  28.           (_s_h_m_f_l_g_&&&&_SSSS_HHHH_MMMM______SSSS_GGGG_IIII______AAAA_NNNN_YYYY_AAAA_DDDD_DDDD_RRRR) is true, the segment is attached at the
  29.           first available address, otherwise the system selects an available
  30.           address that is outside of the reserved area between 0x30000000 and
  31.           0x40000000.  See _mmmm_mmmm_aaaa_pppp(2) and _ssss_gggg_iiii______uuuu_ssss_eeee______aaaa_nnnn_yyyy_aaaa_dddd_dddd_rrrr(1) for more information
  32.           on the reserved range.
  33.  
  34.           If _s_h_m_a_d_d_r is not equal to _((((_vvvv_oooo_iiii_dddd _****_)))) _0000 and (_s_h_m_f_l_g_&&&&_SSSS_HHHH_MMMM______RRRR_NNNN_DDDD) is true,
  35.           the segment is attached at the address given by (_s_h_m_a_d_d_r _---- (_s_h_m_a_d_d_r
  36.           modulus _SSSS_HHHH_MMMM_LLLL_BBBB_AAAA)).
  37.  
  38.           If _s_h_m_a_d_d_r is not equal to _((((_vvvv_oooo_iiii_dddd _****_)))) _0000 and (_s_h_m_f_l_g_&&&&_SSSS_HHHH_MMMM______RRRR_NNNN_DDDD) is false,
  39.           the segment is attached at the address given by _s_h_m_a_d_d_r.
  40.  
  41.      The actual argument corresponding to shmaddr is evaluated by setting an
  42.      INTEGER*4 variable to the location of the process's data segment, in
  43.      other words, the value returned by _%%%%_llll_oooo_cccc(3F).
  44.  
  45.      Under certain conditions, performance can be greatly improved by sharing
  46.      mapping resources among processes attached to the same SHM segment. In
  47.      order to achieve sharing of mapping resources, the following conditions
  48.      must hold:
  49.  
  50.      -   the size of the SHM segment is a multiple of the constant _SSSS_HHHH_MMMM_SSSS_UUUU_SSSS (SHM
  51.          Segment Unit Size).
  52.  
  53.      -   the attaching address sssshhhhmmmmaaaaddddddddrrrr is a multiple of _SSSS_HHHH_MMMM_SSSS_UUUU_SSSS.
  54.  
  55.      -   (_s_h_m_f_l_g_&&&&_SSSS_HHHH_MMMM______RRRR_DDDD_OOOO_NNNN_LLLL_YYYY) is false
  56.  
  57.      The caller authorizes the system to use shared mapping resources by
  58.      setting the flag _SSSS_HHHH_MMMM______SSSS_HHHH_AAAA_TTTT_TTTT_RRRR in _s_h_m_f_l_g.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. sssshhhhmmmmoooopppp((((2222))))                                                              sssshhhhmmmmoooopppp((((2222))))
  71.  
  72.  
  73.  
  74.      If (_s_h_m_f_l_g_&&&&_SSSS_HHHH_MMMM______SSSS_HHHH_AAAA_TTTT_TTTT_RRRR) is true and the above conditions are met the
  75.      system uses shared mapping resources.
  76.  
  77.      If (_s_h_m_f_l_g_&&&&_SSSS_HHHH_MMMM______SSSS_HHHH_AAAA_TTTT_TTTT_RRRR) is true and any of the above conditions are false
  78.      the system call fails.
  79.  
  80.      Use of the _SSSS_HHHH_MMMM______SSSS_HHHH_AAAA_TTTT_TTTT_RRRR flag is discouraged in the following situations:
  81.  
  82.      -    if the calling process is likely to unmap (_m_u_n_m_a_p(2)) or to re-map
  83.           (_m_m_a_p(2)) large portions of the SHM segment, or
  84.  
  85.      -    if the calling process is likely to change the mapping attributes
  86.           (access permissions and cache policies) on large portions of the SHM
  87.           segment (_m_p_r_o_t_e_c_t(2)).
  88.  
  89.      These behaviors cause the system to make private copies of mapping
  90.      resources and stop sharing, thereby defeating the purpose of the
  91.      _SSSS_HHHH_MMMM______SSSS_HHHH_AAAA_TTTT_TTTT_RRRR capability.
  92.  
  93.      _ssss_hhhh_mmmm_dddd_tttt detaches from the calling process's data segment the shared memory
  94.      segment located at the address specified by _s_h_m_a_d_d_r.
  95.  
  96.      The segment is attached for reading if (_s_h_m_f_l_g_&&&&_SSSS_HHHH_MMMM______RRRR_DDDD_OOOO_NNNN_LLLL_YYYY) is true -
  97.      {READ}, otherwise it is attached for reading and writing {READ/WRITE}.
  98.  
  99.      _ssss_hhhh_mmmm_aaaa_tttt fails and does not attach the shared memory segment if one or more
  100.      of the following are true:
  101.  
  102.      _EEEE_IIII_NNNN_VVVV_AAAA_LLLL         _s_h_m_i_d is not a valid shared memory identifier.
  103.  
  104.      _EEEE_AAAA_CCCC_CCCC_EEEE_SSSS         Operation permission is denied to the calling process [see
  105.                     _iiii_nnnn_tttt_rrrr_oooo(2)].
  106.  
  107.      _EEEE_NNNN_OOOO_MMMM_EEEE_MMMM         The available data space is not large enough to
  108.                     accommodate the shared memory segment.
  109.  
  110.      _EEEE_IIII_NNNN_VVVV_AAAA_LLLL         _s_h_m_a_d_d_r is not equal to zero, and the value of (_s_h_m_a_d_d_r _----
  111.                     (_s_h_m_a_d_d_r modulus _SSSS_HHHH_MMMM_LLLL_BBBB_AAAA)) is an illegal address.
  112.  
  113.      _EEEE_IIII_NNNN_VVVV_AAAA_LLLL         _s_h_m_a_d_d_r is not equal to zero, (_s_h_m_f_l_g_&&&&_SSSS_HHHH_MMMM______RRRR_NNNN_DDDD) is false,
  114.                     and the value of _s_h_m_a_d_d_r is an illegal address.
  115.  
  116.      _EEEE_MMMM_FFFF_IIII_LLLL_EEEE         The number of shared memory segments attached to the
  117.                     calling process would exceed the system-imposed limit.
  118.  
  119.      _EEEE_IIII_NNNN_VVVV_AAAA_LLLL         _s_h_m_a_d_d_r is not a multiple of SHMSUS and
  120.                     (_s_h_m_f_l_g_&&&&_SSSS_HHHH_MMMM______SSSS_HHHH_AAAA_TTTT_TTTT_RRRR) is true, or the size of the SHM
  121.                     segment is not a multiple of SHMSUS and
  122.                     (_s_h_m_f_l_g_&&&&_SSSS_HHHH_MMMM______SSSS_HHHH_AAAA_TTTT_TTTT_RRRR) is true.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. sssshhhhmmmmoooopppp((((2222))))                                                              sssshhhhmmmmoooopppp((((2222))))
  137.  
  138.  
  139.  
  140.      _EEEE_AAAA_CCCC_CCCC_EEEE_SSSS         (_s_h_m_f_l_g_&&&&_SSSS_HHHH_MMMM______SSSS_HHHH_AAAA_TTTT_TTTT_RRRR) is true and (_s_h_m_f_l_g_&&&&_SSSS_HHHH_MMMM______RRRR_DDDD_OOOO_NNNN_LLLL_YYYY) is
  141.                     true.
  142.  
  143.      _EEEE_IIII_NNNN_VVVV_AAAA_LLLL         _ssss_hhhh_mmmm_dddd_tttt fails and does not detach the shared memory segment
  144.                     if _s_h_m_a_d_d_r is not the data segment start address of a
  145.                     shared memory segment.
  146.  
  147. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  148.      sgi_use_anyaddr(1), exec(2), exit(2), fork(2), intro(2), shmctl(2),
  149.      shmget(2), sproc(2).
  150.  
  151. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  152.      Upon successful completion, the return value is as follows:
  153.  
  154.           _ssss_hhhh_mmmm_aaaa_tttt returns the data segment start address of the attached shared
  155.           memory segment.
  156.  
  157.           _ssss_hhhh_mmmm_dddd_tttt returns a value of 0.
  158.  
  159.      Otherwise, a value of -1 is returned and _eeee_rrrr_rrrr_nnnn_oooo is set to indicate the
  160.      error.
  161.  
  162. NNNNOOOOTTTTEEEESSSS
  163.      The user must explicitly remove shared memory segments after the last
  164.      reference to them has been removed.
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.